﻿using AppMVVM.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AppMVVM.DataAccess
{
    class CategoryRepository
    {
        private List<Category> _categories;

        public CategoryRepository(IEnumerable<string> categoryNameSet)
        {
            if (_categories == null)
            {
                _categories = new List<Category>();

                foreach (var name in categoryNameSet)
                {
                    _categories.Add(Category.CreateCategory(name));
                }
            }
        }


        public List<Category> GetCategories()
        {
            return new List<Category>(_categories);
        }
    }
}
